package com.coolwen.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

/**
 * @author CoolWen
 * @version 2020-05-21 9:28
 */
@Controller
public class HelloController {
    @GetMapping("/hello")
    @ResponseBody//返回Json
    public String hello() {
        return "Hello Springmvc";
    }

    @GetMapping("/welcome")
    public String welcome() {
        return "wel";
    }

    @GetMapping("/arg")
    public String arg(String title, Model model) {
        System.out.println(title);
        model.addAttribute("title", title);
        return "arg";
    }

    @GetMapping("/args/{title}")
    public String argRest(@PathVariable String title, Model model) {
        model.addAttribute("title", title);
        return "arg";
    }
}
